﻿<%@ Page Title="" Language="C#" MasterPageFile="../Shared/Site.Master" Inherits="ViewPage<BolaoDNA.WebMvc.Areas.Admin.ViewModels.CompeticaoViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Competicao List
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

	<h2>Competicao List</h2>

    <div class="inner">
        <% using (Html.BeginForm(null, null, FormMethod.Post, new { @class="form" })) { %>
			<%= Html.AntiForgeryToken() %>
			<fieldset>
				<legend>Filtrar por</legend>

				<div class="group" id="divUsuarioCadastrado">
					<%=Html.LabelFor(c => c.Instance.CoordenadorCompeticao)%>
					<%= Html.DropDownListFor(c => c.CoordenadorCompeticao_ID, Model.UsuarioCadastradoList, " Todos ")%>
					<span class="description"></span>
				</div>
				<div class="group" id="divSearchQuery">
					<%=Html.LabelFor(c=>c.SearchQuery) %>
					<%= Html.EditorFor(c=>c.SearchQuery)%>
				</div>
				<div class="buttons">
					<button type="submit" class="positive">
						Buscar
					</button>
				</div>
			</fieldset>
		
		    <input type="hidden" name="PreviousSortProperty" value="<%=Model.SortProperty %>" />
            <input type="hidden" name="PreviousSortOrder" value="<%=Model.SortOrder %>" />
            <table class="table">
				<thead>
					<tr>
						<th class="first"><input type="checkbox" class="select-all-activator" /></th>
						<th><button type="submit" name="SortProperty" value="ID">ID</button></th>
						<th><button type="submit" name="SortProperty" value="UsuarioCadastrado.Status">Status</button></th>
						<th><button type="submit" name="SortProperty" value="Nome">Nome</button></th>
						<th class="last"></th>
					</tr>
				</thead>
				<tbody>
<% 
	if (Model.InstanceList.Count == 0) { %>
			<tr align="center"><td colspan="20">Não foi encontrado nenhum registro de Competicao.</td></tr>
<%	}
	else {
	Int32 count = 0;
	foreach (var item in Model.InstanceList) {
		String alt = "";
		if (count % 2 == 1) alt = "class=\"alternate\"";
		count++;%>
					<tr <%=alt%>>
						<td><input type="checkbox" class="select-all" name="DeletedItems" value="<%=item.ID%>" /></td>
						<td><%= Html.Encode(item.ID) %></td>
						<td><%= Html.Encode(item.CoordenadorCompeticao)%></td>
						<td><%= Html.Encode(item.Nome) %></td>
					<td>
						<%= Html.ActionLink("Edit", "Edit/" + item.ID) %> |
						<!--<%= Html.ActionLink("Details", "Details/" + item.ID) %> |-->
						<%= Html.ActionLink("Delete", "Delete/" + item.ID) %>
					</td>
				</tr>
<% } } %>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="20">
						
					</td>
				</tr>
			</tfoot>
		</table>
        <div class="actions-bar wat-cf">
            <div class="actions">
                <button class="button delete-all" type="submit">Delete</button>
                <%= Html.ActionLink("Create New", "Create", null, new { @class="button" } ) %>
             </div>
			<% Html.RenderPartial("Pager", (Web.Generics.FilterParameters)Model); %>
        </div>
	<% } %>
</div>

</asp:Content>

